malloy logoMalloy Documentation

Shape Maps

malloy can create area maps. By currently it uses US maps and state names.

The model and data styles for the subsequent examples is:

export define airports is (explore 'malloy-data.faa.airports'
  primary key code
  airport_count is count(*)
  by_state is (reduce
    state
    airport_count
  )
);

and data styles are

{
  "by_state": {
    "renderer": "shape_map"
  }
} 

Run as a simple query.

Run as a turtle.

explore airports 
| reduce 
  by_state
by_state
5001,0001,500airport_count

Run as a trellis.

explore airports 
| reduce
  faa_region
  airport_count, 
  by_state
faa_region airport_count by_state
AGL 4,437 200400600800airport_count
ASW 3,268 5001,0001,500airport_count
ASO 2,924 200400600800airport_count
AEA 2,586 200400600800airport_count
ANM 2,102 200300400airport_count

Run as a trellis repeated filtered

explore airports 
| reduce
  faa_region
  airport_count, 
  by_state
  heliports is by_state : [fac_type :'HELIPORT']
  seaplane_bases is by_state : [fac_type :'SEAPLANE BASE']
faa_region airport_count by_state heliports seaplane_bases
AGL 4,437 200400600800airport_count 50100150200airport_count 204060airport_count
ASW 3,268 5001,0001,500airport_count 100200300400airport_count 51015airport_count
ASO 2,924 200400600800airport_count 50100150200250airport_count 10203040airport_count
AEA 2,586 200400600800airport_count 100200300airport_count 5101520airport_count
ANM 2,102 200300400airport_count 50100150airport_count 51015airport_count